javascript:(function () {
    /**
     * 获取今天的时间
     * @param date
     * @returns {string}
     */
    function getDate(date) {
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var day = date.getDate();
        month = month >= 10 ? month : ("0" + month);
        day = day >= 10 ? day : ("0" + day);
        return year + "-" + month + "-" + day;
    }

    /**
     * 毫秒值转时分秒
     * @param time
     * @returns {string}
     */
    function getTime(time) {
        time = time == undefined || time == null ? 0 : time;
        let f = time <= 0 ? "" : "-";
        time = Math.abs(time);
        let h = parseInt(time / 60 / 60 % 24);
        h = h < 10 ? '0' + h : h;
        let m = parseInt(time / 60 % 60);
        m = m < 10 ? '0' + m : m;
        let s = parseInt(time % 60);
        s = s < 10 ? '0' + s : s;
        return f + h + ":" + m + ":" + s;
    }

    /**
     * dataURl转Blob(base64转blob)
     * @param fileDataURL
     * @returns {Blob}
     */
    function dataURLToBlob(fileDataURL) {
        let arr = fileDataURL.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length,
            u8arr = new Uint8Array(n);
        while (n--) {
            u8arr[n] = bstr.charCodeAt(n)
        }
        return new Blob([u8arr], {type: mime})
    }

    if (window.it == undefined) {
        let endTime = new Date(getDate(new Date()) + " 18:00:00").getTime();

        var div = document.createElement("div");
        div.setAttribute('id', "djs");
        div.setAttribute(
            'style',
            'position: fixed;bottom: 0px;left: 0px;z-index: 999;background-color: #FFFFFF;'
        );
        document.body.appendChild(div);
        window.it = setInterval(e => {
            let n = Math.floor((new Date().getTime() - endTime) / 1000);
            div.textContent = getTime(n);
        }, 1010)
    } else {
        html2canvas(document.getElementById("djs"), {

            backgroundColor: null,
            useCORS: true,
            scale: 1,
        }).then((canvas) => {
            debugger;
            let url = canvas.toDataURL("image/png");
            let blob = dataURLToBlob(url);

            let ClipboardItem = window.ClipboardItem;
            navigator.clipboard.write([
                new ClipboardItem({
                    [blob.type]: blob,
                }),
            ]);
        });
    }
})()
